package com.dependencies.javamailsender.controller;

import com.dependencies.javamailsender.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhizhou   2024/7/25 16:40
 */
@RestController
public class EmailController {
    
    @Autowired
    private EmailService emailService;
    
    @GetMapping("/sendEmail")
    public String sendEmail() {
        String to = "1184795629@qq.com";
        String subject = "测试邮件标题";
        String text = "你好，一周一志程序员，这是测试邮件请查收";
        emailService.sendSimpleEmail(to, subject, text);
        return "邮件发送成功!";
    }
    
}
